package com.lehecai.core.game;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

/**
 * 服务器充值开关
 * @author He Wang
 */
public class ServerRecharge extends IntegerBeanLabelItem {

	private static final long serialVersionUID = -7754120817858110788L;
	private static final Logger logger = LoggerFactory.getLogger(ServerRecharge.class.getName());
	
	private static List<ServerRecharge> items = new ArrayList<ServerRecharge>();
	private static List<ServerRecharge> queryItems = new ArrayList<ServerRecharge>();
	
	protected ServerRecharge(String name, int value) {
		this(name, value, false);
	}
	
	protected ServerRecharge(String name, int value, boolean queryOnly) {
		super(ServerRecharge.class.getName(), name, value);
		queryItems.add(this);
		
		if (!queryOnly) {
			items.add(this);
		}
	}
	
	public static ServerRecharge getItem(int value){
		try {
			return (ServerRecharge)ServerRecharge.getResult(ServerRecharge.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<ServerRecharge> getItems() {
		return items;
	}
	
	public static List<ServerRecharge> getQueryItems() {
		return queryItems;
	}

	public static final ServerRecharge ALL = new ServerRecharge("全部", -1, true);
	public static final ServerRecharge SERVER_RECHARGE_OPEN = new ServerRecharge("开", 1);				
	public static final ServerRecharge SERVER_RECHARGE_CLOSE = new ServerRecharge("关", 0);
}
